Skip to content

fix: review agent app requests before first use - #512

Merged
CraftOS-dev merged 8 commits into
V1.4.5from
fix/trigger-approval-modal
Nov 2, 2026
Merged

CraftOS-dev merged 8 commits into
V1.4.5from
fix/trigger-approval-modal

Conversation

@ahmad-ajmal

@ahmad-ajmal ahmad-ajmal commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

What

Move Agent App request approval to a visible review before first use and after new or changed request definitions are delivered. The app runs in the background while the user reviews its requests.

  • Apply the same flow to imported/marketplace apps and apps created or evolved in CraftBot. Show descriptions, expandable instructions, input definitions/defaults, and new/changed/already allowed labels. Bind approval to the app identity and exact reviewed definitions; discard publisher approvals on acquisition.
  • Allow explicit approval or Keep requests off while the app stays usable. Closing with X, Escape or the backdrop preserves permissions and suppresses only that revision for the current browser session. Saved decisions survive reloads/restarts; unchanged allowed requests do not prompt again.
  • When a request is refused for missing permission, show a CraftBot notification naming the app with a Review requests action. Group repeats by app and review revision, including after notification dismissal. An open review already provides the feedback, so it does not get a duplicate warning. A notification failure never permits dispatch.
  • After a matching successful approval save, show Requests are now allowed. Try the action again. This confirms permission only; it does not claim that the app or action is ready. Do not show it for denials, failed saves, unrelated responses or disconnected requests.
  • Show a permission banner on both the full app page and chat side panel while requests need approval. Hide it once all requests are approved; new/changed requests bring it back. Keep Review requests available in the app's sidebar menu for later review or revocation.
  • Clear resolved warnings when permissions synchronize or an app is removed. Only the matching project/request response settles a local decision or error. Reviewing permissions preserves the app iframe and its contents.
  • Freeze the reviewed instruction and parameter definitions in queued work. Missing values use the captured defaults even if triggers.json changes before processing. Newly fired requests using changed definitions remain blocked until reviewed.
  • Keep requests off clears approvals even when definitions are corrupt, invalid, unreadable or the displayed review is stale. Repair cannot silently restore the old approval. New grants require a valid current review; failed saves remain visible errors and support retry.

Why

An app could appear broken because a request was refused pending an approval the user did not know was needed. Users now see the review before use and receive actionable feedback if a later request is blocked.

Legacy per-app booleans do not identify reviewed definitions, so existing apps receive one UI review. The agent-facing approval action, chat consent-question runs and creation/promotion pre-approval are removed. Bridge authentication, capabilities, cooldowns and development-environment deferral remain enforced. Earlier blocked requests are never automatically replayed after approval.

How to test

  1. Import/install or create an app with requests, then launch it. Confirm review appears before requests are allowed, with the app running in the background. Apps without requests must not prompt.
  2. Choose Keep requests off and fire a declared request. Confirm it stays blocked without starting an agent run. From another chat, confirm one notification names the app, explains the missing permission and offers Review requests. Repeat fires must not stack notifications.
  3. Click the notification action. Confirm the correct app's review opens, including after a catalog refresh. Check the persistent banner on the full app page and chat side panel at desktop and phone widths.
  4. Allow all requests. Confirm the banner and blocked warning disappear in both app views without reloading the app's contents. Confirm the success notification says Requests are now allowed. Try the action again. only after the save succeeds. Fire a new request to verify normal execution; earlier blocked requests must not replay.
  5. Use the app sidebar's ... menu → Review requests to inspect/revoke an existing grant. X/Escape/backdrop must preserve it; Keep requests off must revoke it.
  6. Deliver new/changed instructions or only a changed recipient default. Confirm fresh review, visible input values (including false, zero, empty text and allowed values), and preservation of unchanged grants. Stale review revisions must not authorize new work.
  7. With multiple clients, confirm permission snapshots synchronize without unrelated replies settling another decision or retry. Granting access or deleting the app should clear its warning.
  8. Force a consent write failure. Confirm the error remains visible, retry works, and dismissal allows app use without claiming the save succeeded or reopening the same revision immediately.
  9. Approve an app, corrupt or make triggers.json unreadable, then choose Keep requests off. Repair and reload/restart: requests must remain blocked pending fresh approval. Saving a denial failure must be reported.
  10. Queue an approved request with omitted parameters, edit definitions before processing, and confirm the queued instruction/defaults remain the captured approved values. Newly fired requests stay blocked until review.
  11. Review 30 requests on desktop and phone. Reach the last expanded instruction while both decision buttons remain reachable; verify keyboard focus stays in the top dialog and restores on close.

Validation

  • 82 targeted Python tests passed, covering consent persistence/revocation, exact definitions, queued snapshots, authenticated bridge gates and blocked-request notifications (including notification failure).
  • 56 targeted Playwright tests passed without retries: 29 consent tests, 11 feedback/banner/menu tests, 14 app panel tests and 2 synthetic media tests. Covers notification grouping, correct review routing, cross-client updates, 320px/390px responsiveness, banner removal after approval, menu revocation, iframe preservation and 30-request scrolling. Five new cases check the saved-approval confirmation and its absence for unrelated, failed, denied and disconnected decisions; duplicate responses do not repeat it.
  • Trigger-plane acceptance: all green. Changed Python files pass Ruff lint/format. TypeScript tsc --noEmit, Vite production build and git diff --check pass. Earlier data-safety acceptance passed in a disposable profile.
  • Live verification used the rebuilt CraftBot backend and disposable QA profile. Four authenticated blocked fires returned HTTP 403 and produced one notification while another chat was open; its action opened the correct app review. The side-panel banner appeared, and approving the local-only QA app removed its banner. The marketplace app's denied permissions were preserved. Latest live UI verification: keeping requests off retained the banner without a success notification; allowing the local QA app then removed the banner and displayed the exact saved-approval confirmation. A fresh screenshot captures this state. No new agent task was dispatched for this confirmation check.
  • Full-repository Ruff has two existing F402 errors in app/credentials/vault.py (1087 and 1145), already present on the base branch.

Latest feedback screenshots

The first seven captures show the running CraftBot UI with disposable test apps/data. The two phone captures use the automated responsive fixture. Images live on the separate screenshots branch and are not part of the source diff.

Blocked-request feedback, banners and permission management (9 screenshots)

Blocked request while viewing another chat

Four refused fires produced one actionable notification.

Blocked request while viewing another chat

Review opened from the notification

Review requests opened the correct Expenses Tracker dialog.

Review opened from the notification

Permission banner in the chat side panel

The app remains usable while its requests are off.

Permission banner in the chat side panel

Before approval

The local-only QA app shows the banner while requests are off.

Before approval

After approval

The banner disappears once all requests are approved.

After approval

Saved approval confirmation

The running app confirms only that permission was saved. The banner disappears, and earlier blocked actions require a new attempt.

Saved approval confirmation

Permissions remain accessible from the app menu

Review requests remains available after the banner disappears.

Permissions remain accessible from the app menu

Notification at phone width

Responsive fixture: the warning and Review requests action fit at 390px; 320px is also tested.

Notification at phone width

Approved app panel at phone width

Responsive fixture: the approved app keeps its contents and no longer shows the permission banner.

Approved app panel at phone width

Earlier consent-flow screenshots and live validation

Live verification used the real CraftBot backend, PocketBase app, and configured model in an isolated profile:

Case Observed result
Before UI approval Bridge returns 403 without starting a consent-question run
Keep requests off App remains usable; review banner remains; decision survives reload
Allow through the modal A declared request is claimed and completed by the agent
Change the allowed definition Bridge returns 403; modal identifies Changed request and Already allowed entries

The review modal also explains that app requests can start agent work and use connected services, including while the app is not being viewed.

Screenshot evidence

Captures use disposable local test data. The desktop and phone scrolling screenshots show the rebuilt focus fix.

Marketplace first-launch review

The installed app lists both requests before they can run.

Marketplace first-launch review

Native import requires fresh approval

The imported ZIP contained publisher approval data; the acquired app still required a new user decision.

Native import requires fresh approval

New and changed requests

The review distinguishes already allowed, new and changed definitions.

New and changed requests

Approved request completes

Earlier live execution verified that an allowed request can be claimed and completed by CraftBot. The new approval notification confirms permission was saved; an individual action still needs to be attempted and can succeed or fail independently.

Thirty requests on desktop

The list scrolls to request 30 while both decision buttons remain outside the scrolling area.

Thirty requests on desktop

Thirty requests at phone width

At 390 x 844, the final request and expanded instructions are reachable and the decision buttons remain visible.

Thirty requests at phone width

Supersedes #510 after renaming the source branch to fix/trigger-approval-modal.

@ahmad-ajmal
ahmad-ajmal changed the base branch from dev to V1.4.5 October 29, 2026 09:39
Signed-off-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
@ahmad-ajmal
ahmad-ajmal force-pushed the fix/trigger-approval-modal branch from 013a692 to 1e6409e Compare October 29, 2026 09:43
@ahmad-ajmal ahmad-ajmal self-assigned this Oct 30, 2026
@CraftOS-dev
CraftOS-dev merged commit d417f4b into V1.4.5 Nov 2, 2026
3 checks passed
ahmad-ajmal pushed a commit that referenced this pull request Nov 19, 2026
fix: review agent app requests before first use
@ahmad-ajmal
ahmad-ajmal deleted the fix/trigger-approval-modal branch November 20, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants